﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit;
using NUnit.Framework;
using System.Xml.Linq;
using DataSetMerge.Mergers;
using System.IO;

namespace WixMergeIntegrationTests
{
    [TestFixture]
    public class WixHarvestMergerTests
    {
        XElement target;
        XElement source;
        XElement result;
        WixHarvestMerger op;

        [SetUp]
        public void Setup()
        {
            target = XElement.Load(Path.Combine(Directory.GetCurrentDirectory(), "Target.wxs"));
            source = XElement.Load(Path.Combine(Directory.GetCurrentDirectory(), "Source.wxs"));

            op = new WixHarvestMerger();
        }

        [Test]
        public void GivenDistinctHarvestFiles_WhenMergerMerge_TheResultHarvestFileResultLooksAsExpected()
        {
            result = XElement.Load(Path.Combine(Directory.GetCurrentDirectory(), "Result.wxs"));

            op.MergeData(target, source);

            Assert.AreEqual(result.ToString(), target.ToString());
        }
    }
}
